#pragma once
#include <map>
#include "Wndbase.h"
#include "ISUI.h"

class WndManager
{
public:
	static WndManager * Get();
protected:
	WndManager();
	~WndManager();
public:
	Wndbase::Ptr CreateWnd(LPCTSTR idWnd, HWND hOwner, LPCTSTR file, bool bSubclass, WndCallback wndCallback, NotifyCallback notifyCallback);
	Wndbase::Ptr ShowWnd(LPCTSTR idWnd, bool bShow);
	int ShowModalWnd(LPCTSTR idWnd);
	Wndbase::Ptr CloseWnd(LPCTSTR idWnd, UINT nRet, bool bAsync);
	void CloseAllWnd(bool bAsync);

	Wndbase::Ptr FindWnd(LPCTSTR idWnd) const;
	void AddWnd(LPCTSTR idWnd, const Wndbase::Ptr &wnd);
	void RemoveWnd(Wndbase *wnd);

private:
	std::map<CString, Wndbase::Ptr> m_wndMap;
};

